<?php include './admin/view/header.inc.htm'; ?>

<?php if(!$readable) { ?>
<div class="notice error">配置文件 conf/conf.php 不可写，部分修改可能无法保存。</div>
<?php } ?>

<div class="panel">
	<div class="header">IP 限制</div>
	<div class="body">
		<form method="POST" id="form" action="admin/ip.htm">
			<table class="form">
				<tr>
					<th style="width: 150px;">是否启用IP限制：</th>
					<td>
						<?php echo $input['ipaccess_on']; ?>
					</td>
				</tr>
				<tr>
					<th>每日发送邮件数：</th>
					<td>
						<?php echo $input['ipaccess_mails']; ?>
					</td>
				</tr>
				<tr>
					<th>每日最大主题数：</th>
					<td>
						<?php echo $input['ipaccess_threads']; ?> 0 为不限制
					</td>
				</tr>
				<tr>
					<th>每日最大回帖数：</th>
					<td>
						<?php echo $input['ipaccess_posts']; ?>
					</td>
				</tr>
				<tr>
					<th>每日最大附件数：</th>
					<td>
						<?php echo $input['ipaccess_attachs']; ?>
					</td>
				</tr>
				<tr>
					<th>每日最大附件大小：</th>
					<td>
						<?php echo $input['ipaccess_attachsizes']; ?>
					</td>
				</tr>
				<tr>
					<th>&nbsp;</th>
					<td>
						<button type="submit" id="submit" loading-text="正在提交" class="blue big">确定</button>
					</td>
				</tr>
			<table>
		</form>
	</div>
</div>

<?php include './admin/view/footer.inc.htm'; ?>

<script>
var jform = $("#form");
var jsubmit = $("#submit");

jform.on('submit', function(){
	var postdata = jform.serialize();
	jsubmit.button('loading');
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			jsubmit.text(message);
			setTimeout(function(){ jsubmit.button('reset'); }, 1000);
			return;
		} else {
			$.alert(message);
			jsubmit.button('reset');
		}
	});
	return false;
});
</script>